﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using ibba.agil.monitor.proxy;
using Winsoft.Framework.MonitorProxy;

namespace ibba.agil.core.common
{
    public class ServiceException : Exception
    {
        private string CustomMessage { get; set; }

        public ServiceException(Int16 cp,  string operation, string customMessage, Exception e)
            : base(customMessage, e)
        {
            CustomMessage = customMessage;
            var monitor = MonitorClientFactory.Create();
            monitor.TraceError(new MonitorData { TracePoint = cp, OperationName = operation, TraceMessage = e.Message + " >> " + e.StackTrace });
        }

        public override string Message
        {
            get
            {
                return CustomMessage;
            }
        }
    }
}
